﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IdentityModel.Selectors;
using System.ServiceModel;
using VLUSM_BusinessLogic;
using Microsoft.Practices.Unity;

namespace VLUSM_Service
{
    public class Validator : UserNamePasswordValidator
    {
        IUnityContainer container = new UnityContainer();
        UserAccountManager manager;
        public Validator()
        {
            manager = container.Resolve<UserAccountManager>();
        }

        public override void Validate(string userName, string password)
        {
            if (!manager.Validate(userName, password))
            {
                throw new FaultException("Incorrect Username or Password");
            }
        }
    }
}
